﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Masters/General.Master" AutoEventWireup="true" CodeBehind="MyFBInfo.aspx.cs" Inherits="PB.FBMembershipWebApp.Mem.MyFBInfo" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
<h2>My Facebook Info</h2>
<br />
<br />
    <asp:PlaceHolder ID="PlaceHolderFBInfo" runat="server">
        <fb:name uid="loggedinuser" useyou="false" linked="false"  />
        <br />
        <fb:profile-pic uid="loggedinuser" size="n" linked="false" facebook-logo-"false" />
        <br />
        <br />
        <br />
        First Name : <fb:name uid="loggedinuser" useyou="false" linked="false" firstnameonly="true" />
        <br />
        Last Name : <fb:name uid="loggedinuser" useyou="false" linked="false" lastnameonly="true" />
        <br />
        Gender : <%=fbUser.FacebookUser.sex%>
        <br />
        Birthday : <%=fbUser.FacebookUser.birthday%>
        <br />
        Relationship Status : <%=fbUser.FacebookUser.relationship_status%>
        <br />
        Location : <%=location%>
        <br />
        <br />
        <br />
        Status : <fb:user-status uid="<%=fbUser.UserName%>" linked="false"/>
        <br />
        <br />
        <br />
        My Friends:
        <div id="myfbFriends" style="margin-left:10px; padding-left:10px"></div>
        <script type="text/javascript">
            var widget_div = document.getElementById("myfbFriends");
            FB.ensureInit(function() {
                FB.Facebook.get_sessionState().waitUntilReady(function() {
                    FB.Facebook.apiClient.friends_get(null, function(result) {
                        var markup = "";
                        var trFlag = false;
                        var num_friends = result.length;
                        if (num_friends > 0) {
                            markup += '<table cellpadding="0" cellspacing="0" border="0" width="100%">';
                            for (var i = 0; i < num_friends; i++) {
                                if (i % 2 == 0) {
                                    markup += "<tr>";
                                    trFlag = true;
                                }
                                markup += '<td style="width:50%"><fb:profile-pic  uid="' + result[i] + '" facebook-logo="true" linked="false"></fb:profile-pic>';
                                markup += '&nbsp;&nbsp;' + '<fb:name uid="' + result[i] + '" useyou="false" linked="false"  /></td>';
                                if (i % 2 != 0) {
                                    markup += "</tr>";
                                    trFlag = false;
                                }
                            }
                            if (trFlag == trFlag)
                                markup += "</tr>";
                            markup += "</table>";
                        }
                        widget_div.innerHTML = markup;
                        FB.XFBML.Host.parseDomElement(widget_div);
                    });
                });
            });
        </script>
    </asp:PlaceHolder>
</asp:Content>
